package com.lanou.lenanapp.beans;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import org.json.JSONException;
import org.json.JSONObject;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by dllo on 15/10/22.
 */
public class JokeReviewHot {


    /**
     * content :  昨晚遇到个逗比， 发了个两百的红包。来的早不如来的巧啊。
     * uid : 93251476
     * author_name : 我向生活低了头
     * author_avatar : http://qzapp.qlogo.cn/qzapp/100499246/A40B81D616002BED3AD8F8A6C351803F/100
     * is_exported : 0
     * created_time : 1444979788
     * cid : 447955
     * likes : 72
     * dislikes : 0
     */

    private String content;
    private String uid;
    private String author_name;
    private String author_avatar;
    private String is_exported;
    private String created_time;
    private String cid;
    private String likes;
    private String dislikes;

    public static JokeReviewHot objectFromData(String str) {

        return new Gson().fromJson(str, JokeReviewHot.class);
    }

    public static JokeReviewHot objectFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);

            return new Gson().fromJson(jsonObject.getString(str), JokeReviewHot.class);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }

    public static List<JokeReviewHot> arrayJokeReviewHotFromData(String str) {

        Type listType = new TypeToken<ArrayList<JokeReviewHot>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public static List<JokeReviewHot> arrayJokeReviewHotFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);
            Type listType = new TypeToken<ArrayList<JokeReviewHot>>() {
            }.getType();

            return new Gson().fromJson(jsonObject.getString(str), listType);

        } catch (JSONException e) {
            e.printStackTrace();
        }

        return new ArrayList();


    }

    public void setContent(String content) {
        this.content = content;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public void setAuthor_name(String author_name) {
        this.author_name = author_name;
    }

    public void setAuthor_avatar(String author_avatar) {
        this.author_avatar = author_avatar;
    }

    public void setIs_exported(String is_exported) {
        this.is_exported = is_exported;
    }

    public void setCreated_time(String created_time) {
        this.created_time = created_time;
    }

    public void setCid(String cid) {
        this.cid = cid;
    }

    public void setLikes(String likes) {
        this.likes = likes;
    }

    public void setDislikes(String dislikes) {
        this.dislikes = dislikes;
    }

    public String getContent() {
        return content;
    }

    public String getUid() {
        return uid;
    }

    public String getAuthor_name() {
        return author_name;
    }

    public String getAuthor_avatar() {
        return author_avatar;
    }

    public String getIs_exported() {
        return is_exported;
    }

    public String getCreated_time() {
        return created_time;
    }

    public String getCid() {
        return cid;
    }

    public String getLikes() {
        return likes;
    }

    public String getDislikes() {
        return dislikes;
    }
}
